import request from '@/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/blade-group/group/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/blade-group/group/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/blade-group/group/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/blade-group/group/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/blade-group/group/submit',
    method: 'post',
    data: row
  })
}

export const treeWithCrf = (groupId) => {
  return request({
    url: '/blade-phase/phase/treeWithCrf',
    method: 'get',
    params: {
      groupId
    }
  })
}

export const lisWithSort = (current, size, params) => {
  return request({
    url: '/blade-npothercrf/npOtherCrf/lisWithSort',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const npOtherCrfPage = (current, size, params) => {
  return request({
    url: '/blade-npothercrf/npOtherCrf/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const deptOfTrial = (trial) => {
  return request({
    url: '/blade-trial/trial/deptOfTrial',
    method: 'get',
    params: {
      trial
    }
  })
}

export const npOtherCrfSave = (row) => {
  return request({
    url: '/blade-npothercrf/npOtherCrf/submit',
    method: 'post',
    data: row
  })
}

export const npOtherCrfRemove = (ids) => {
  return request({
    url: '/blade-npothercrf/npOtherCrf/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const addGroupCaseNum = (row) => {
  return request({
    url: '/blade-group/group/addGroupCaseNum',
    method: 'post',
    params: row
  })
}

export const addToProcessLibrary = (groupId,name) => {
  return request({
    url: '/blade-group/group/addToProcessLibrary',
    method: 'get',
    params: {
      groupId,
      name
    }
  })
}

export const copyFromProcessLibrary = (processLibraryId,groupId) => {
  return request({
    url: '/blade-group/group/copyFromProcessLibrary',
    method: 'get',
    params: {
      processLibraryId,
      groupId,
    }
  })
}

export const processLibraryTreeWithCrf = (processLibraryId) => {
  return request({
    url: '/blade-phase/phase/processLibraryTreeWithCrf',
    method: 'get',
    params: {
      processLibraryId,
    }
  })
}

export const getCrfDetail = id => {
  return request({
    url: '/blade-crf/crf/detail',
    method: 'get',
    params: {
      id,
    },
  });
};

export const crfListOfGroup = (type,groupId) => {
  return request({
    url: '/blade-group/group/crfListOfGroup',
    method: 'get',
    params: {
      type,
      groupId
    },
  });
};

export const crfOverviewOfGroup = (groupId) => {
  return request({
    url: '/blade-group/group/crfOverviewOfGroup',
    method: 'get',
    params: {
      groupId
    },
  });
};